/**
 * 
 */
package com.coder520.sync_learning.demo;

/**
 * @author zhaoyibo
 *
 */
public class ThreadSleep {
	public static void main(String[] args) {
		new Thread(() ->{
			long startTime=System.currentTimeMillis();
			sleep(2_000L);
			long endTime=System.currentTimeMillis();
			System.out.println(String.format("Total spend %d ms", (endTime-startTime)));
		}).start();
		
		long startTime =System.currentTimeMillis();
		sleep(3_000l);
		long endTime=System.currentTimeMillis();
		System.out.println(String.format("main thread total spend %d ms",(endTime-startTime)));
	}

	/**
	 * @Description:
	 * @param l
	 * @author zhaoyibo  
	 * @date 2019年2月18日  下午8:24:46
	 */
	private static void sleep(long l) {
		// TODO Auto-generated method stub
		try {
			Thread.sleep(l);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
